package com.superbytecode.cloud.common.exception;

import lombok.Getter;

/**
 * All rights Reserved, Designed By www.super-master.com
 *
 * @ProjectName: beacon-cloud
 * @Package: com.superbytecode.cloud.common.exception
 * @ClassName: BusinessException
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2024/10/21 16:56
 * @Version: V1.0
 * @Copyright: 2024 www.super-master.cn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@Getter
public class BusinessException extends RuntimeException {
    private final String errcode;
    private final String errmesg;

    public BusinessException(IErrorCode errorCode) {
        super(errorCode.getCode() + errorCode.getMessage());
        this.errcode = errorCode.getCode();
        this.errmesg = errorCode.getMessage();
    }

    public BusinessException(String code, String message) {
        super(code + message);
        this.errcode = code;
        this.errmesg = message;
    }

    public BusinessException(String megs) {
        super(megs);
        this.errcode = ErrorCodeEnum.FAILURE.getCode();
        this.errmesg = megs;
    }
}